﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="User.aspx.cs" Inherits="home_User" %>
<%@ Register TagPrefix="PM" TagName="LeftMenu" Src="~/control/LeftMenu.ascx" %>
<%@ Register TagPrefix="PM" TagName="Header" Src="~/control/Header.ascx" %>
<%@ Register TagPrefix="PM" TagName="Footer" Src="~/control/Footer.ascx" %>
<%@ Register TagPrefix="PM" TagName="Pager" Src="~/control/Pager.ascx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Works management</title>
    <link rel="Stylesheet" type="text/css" href="../css/style.css" media="all" />
    <link rel="Stylesheet" type="text/css" href="../css/window.css" media="all" />
    <link rel="Stylesheet" type="text/css" href="../css/button.css" media="all" />
    <script type="text/javascript" language="javascript" src="../js/jquery-1.4.1.js"></script>
    <script type="text/javascript" language="javascript" src="../js/md5.js"></script>
    <script type="text/javascript" language="javascript" src="../js/commonfunctions.js"></script>
    <script type="text/javascript" language="javascript" src="../js/user.js"></script>
    <script type="text/javascript" language="javascript" src="../js/dragwindow.js"></script>
    <script type="text/javascript" language="javascript">
        setDrag("#window_user");
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <PM:Header ID="header" runat="server" /> 
    <div class="clear"></div>
        <table>
            <tr>
                <td style="vertical-align:top;">
                    <PM:LeftMenu ID="left_menu" runat="server" />
                </td>
                <td style="vertical-align:top;">
                    <div id="main">
                        <asp:Panel runat="server" ID="menu">
                            <a href="#" id="add">
                                <img alt="" src="../images/Add.png" />
                                <span>Thêm mới</span>
                            </a>
                            <!--<asp:LinkButton runat="server" ID="edit">
                                <img alt="" src="../images/Edit.png" />
                                <span>Sửa</span>
                            </asp:LinkButton>
                            <asp:LinkButton runat="server" ID="delete">
                                <img alt="" src="../images/Delete.png" />
                                <span>Xóa</span>
                            </asp:LinkButton>
                            -->
                        </asp:Panel>
                        <div style="float:right;">
                            <span runat="server" id="label1">Sắp xếp theo</span>
                            <asp:DropDownList runat="server" ID="orderby" 
                                AutoPostBack="true" onselectedindexchanged="orderby_SelectedIndexChanged"
                                >
                                <asp:ListItem Selected="True" Text="Tên người dùng" Value="userName"></asp:ListItem>
                                <asp:ListItem Text="Quyền" Value="permission"></asp:ListItem>
                            </asp:DropDownList>
                            <span runat="server" id="label2">Theo thứ tự</span>
                            <asp:DropDownList runat="server" ID="order" 
                                AutoPostBack="true" onselectedindexchanged="order_SelectedIndexChanged"
                                >
                                <asp:ListItem Selected="True" Text="Giảm dần" Value="DESC"></asp:ListItem>
                                <asp:ListItem Text="Tăng dần" Value="ASC"></asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div class="clear"></div>
                        <asp:GridView runat="server" ID="users" AutoGenerateColumns="false"
                          DataKeyNames="id" Width="100%" CellPadding="5" onrowcommand="users_RowCommand" 
                          
                          >
                         <Columns>
                            <asp:BoundField DataField="id" Visible="false" />
                            <asp:BoundField HeaderText="STT" DataField="order" />
                            <asp:TemplateField ItemStyle-CssClass="name" HeaderText="Tên người dùng">
                                <ItemTemplate>
                                    <asp:HyperLink ID="HyperLink1" Text='<%#Eval("userName")%>' runat="server"
                                     NavigateUrl='<%#"~/home/GetWork.aspx?user="+Eval("id")%>' 
                                    >
                                    </asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Quyền">
                                <ItemTemplate>
                                    <%#DisplayEnum.DisplayPermission(Int32.Parse(Eval("permission").ToString())) %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Phân dự án">
                                <ItemTemplate>
                                    <a href='<%#"/workmanagement/home/GetWork.aspx?user="+Eval("id")%>'>Phân dự án</a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Chức năng" ItemStyle-Width="60">
                                <ItemTemplate>
                                    <a href="#" id="editUser" onclick="return editUser('<%#Eval("id")%>');">
                                        <img alt="" src="../images/Edit.png" />
                                    </a>
                                    <asp:LinkButton PostBackUrl="" runat="server" CommandName="removeuser" CommandArgument='<%#Eval("id")%>' 
                                        ID="lbremoveuser" OnClientClick="return confirm('Xóa người dùng này ?');">
                                        <img alt="" src="../images/Delete.png" />
                                    </asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                         </Columns>
                        </asp:GridView>
                        <asp:Label runat="server" ID="display"></asp:Label>
                        <PM:Pager runat="server" ID="pager" />
                    </div>
                </td>
            </tr>
        </table>
        <div class="clear"></div>
        <PM:Footer runat="server" ID="footer" />
        <!-- pop up window -->
        <div class="transparent_window" >
        </div>
        <div class="content_window" id="window_user">
            <div class="header">
                <span id="window_title">Thêm người dùng</span>
                <a href="#" class="close">&nbsp;</a>
            </div>
            <div class="main">
                <table cellpadding="2px" cellspacing="0" width="85%">
                     <tr>
                        <td class="title">Họ tên</td>
                        <td>
                            <input id="fullname_user" type="text" class="txt" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title">Tên đăng nhập(*)</td>
                        <td>
                            <input id="name_user" type="text" class="txt" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title" id="pass">Mật khẩu(*)</td>
                        <td>
                            <input id="pass_user" type="password" class="txt" />
                            <input type="hidden" id="password_user" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Email(*)
                        </td>
                        <td> 
                            <input id="email_user" type="text" class="txt" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Di động
                        </td>
                        <td> 
                            <input id="phone_user" type="text" class="txt" />
                        </td>
                    </tr>
                     <tr>
                        <td class="title">
                            <span id="permission">Quyền</span>
                        </td>
                        <td> 
                            <select id="permission_user">
                                <option selected="selected" value="5">Người dùng</option>
                                <option value="4">Trưởng nhóm</option>
                                <option value="3">Quản lý</option>
                            </select>
                        </td>
                    </tr>
                     <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td> 
                            <input checked="checked" type="checkbox" id="mailwhenwork_user"/>Nhận mail khi có việc mới
                            <br />
                            <input checked="checked" type="checkbox" id="mailwhencomment_user" />Nhận mail khi có comment mới
                        </td>
                    </tr>
                </table>
            </div>
            <div class="footer">
                <asp:LinkButton ID="btOk" runat="server" Text="OK" CssClass="ok" OnClientClick="return addUser();"
                  OnClick="btOk_Click">
                </asp:LinkButton>
                <a href="#" class="cancel">Cancel</a>
            </div>
        </div>
    </form>
</body>
</html>
